<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templateadmin.xhtml">
        <ui:define name="content">
            <h:form>
                <center>
                    <h2>Management Places</h2>
                    <br/>
                    <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                        <tr>
                            <th class="table-header-repeat line-left minwidth-1" width="100px" ><a href="">Place ID</a>	</th>
                            <th class="table-header-repeat line-left minwidth-1" width="200px"><a href="">Location ID</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="200px"><a href="">Place Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="300px"><a href="">Description</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                        </tr>
                        <ui:repeat value="#{mngPlacesBean.listPlace}" var="place">
                            <tr>
                                <td>#{place.placeID}</td>
                                <td>
                                    <h:selectOneMenu value="#{place.locationID}" styleClass="styledselect_form_1">
                                        <f:selectItems value="#{mngPlacesBean.listLocal}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                                    </h:selectOneMenu>
                                </td>
                                <td>
                                    <h:inputText id="txtName" value="#{place.placeName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                    <br/>
                                    <h:message for="txtName" styleClass="error-inner"></h:message>
                                </td>
                                <td>
                                    <h:inputTextarea id="txtDes" value="#{place.description}" styleClass="form-textarea2" required="true" requiredMessage="This field is required."></h:inputTextarea>
                                    <br/>
                                    <h:message for="txtDes" styleClass="error-inner"></h:message>
                                </td>
                                <td>
                                    <h:commandButton action="#{mngPlacesBean.updatePlacesAction(place)}" value="Update" styleClass="form-update" onclick="show_alert()"></h:commandButton>
                                </td>
                            </tr>
                        </ui:repeat>
                    </table>
                </center>
            </h:form>
            <center>
                Page : <ui:repeat value="#{mngPlacesBean.listPage}" var="index">
                    <a href="managementplaces.xhtml?pageID=#{index}">#{index}</a> -
                </ui:repeat>
                
            </center>
            <br/>
            <h:form>
                <center>
                    <table border="0" cellpadding="0" cellspacing="0" id="product-table" style="margin: 0 0 0 151px;">
                        <tr>
                            <!--                        <th class="table-header-repeat line-left minwidth-1" width="150px" ><a href="">Place ID</a>	</th>-->
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Location ID</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Place Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="320px"><a href="">Description</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="120px"><a href="">Option</a></th>
                        </tr>
                        <tr>
                            <td>
                                <h:selectOneMenu value="#{mngPlacesBean.place.locationID}" styleClass="styledselect_form_1">
                                    <f:selectItems value="#{mngPlacesBean.listLocal}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                                </h:selectOneMenu>
                            </td>
                            <td>
                                <h:inputText id="txtName" value="#{mngPlacesBean.place.placeName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                <br/>
                                <h:message for="txtName" styleClass="error-inner"></h:message>
                            </td>
                            <td>
                                <h:inputTextarea id="txtDes" value="#{mngPlacesBean.place.description}" styleClass="form-textarea2" required="true" requiredMessage="This field is required."></h:inputTextarea>
                                <br/>
                                <h:message for="txtName" styleClass="error-inner"></h:message>
                            </td>
                            <td>

                                <h:commandButton action="#{mngPlacesBean.addNewPlaceAction}" styleClass="form-submit" onclick="show_alert()"></h:commandButton>
                            </td>
                        </tr>
                    </table>
                </center>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

